<template>
    <div>
        <div class="top">
            <div class="top_wx">
                学校
            </div>
            <div class="top_sj">
                {{ currentTime  }}
            </div>
        </div>
        <div>
            <div class="shuju">
                <div style="color: #333; font-size: 14px;" class="shuji_s">
                    实时数据
                </div>
                <div>
                    <div class="shuji_j">
                        <span>今日学生出勤</span>
                        <br>
                        <span>1500/1523</span>
                    </div>
                    <div class="shuji_j">
                        <span>今日教师出勤</span>
                        <br>
                        <span>31/36</span>
                    </div>
                    <div class="shuji_j">
                        <span>今日上报隐患</span>
                        <br>
                        <span>2</span>
                    </div>
                </div>
            </div>
            <div class="tgao">
                <div style="color: #333; font-size: 14px;" class="shuji_c">
                    <div style="float: left;">校园通报</div>
                    <div style="float: right;">更多></div>
                </div>
                <div style="text-align: center;line-height: 80px;">
                    <div style="color: #999;">今日暂无通告</div>
                </div>
            </div>
        </div>
        <div>
            <div class="jichu">
                <div style="color: #333; font-size: 14px;" class="shuji_s">
                    基础信息概览
                </div>
                <div>
                    <div class="shuji_xx">
                        <span>学生数量</span>
                        <br>
                        <span>1523</span>
                    </div>
                    <div class="shuji_xx">
                        <span>教职工数量</span>
                        <br>
                        <span>63</span>
                    </div>
                    <div class="shuji_xx">
                        <span>安全小组人员</span>
                        <br>
                        <span>2</span>
                    </div>
                    <div class="shuji_xx">
                        <span>安保人数</span>
                        <br>
                        <span>10</span>
                    </div>
                </div>
                <div>
                    <div class="shuji_xx">
                        <span>巡查点数量</span>
                        <br>
                        <span>33</span>
                    </div>
                    <div class="shuji_xx">
                        <span>访客机数量</span>
                        <br>
                        <span>5</span>
                    </div>
                    <div class="shuji_xx">
                        <span>护导点数量</span>
                        <br>
                        <span>12</span>
                    </div>
                    <div class="shuji_xx">
                        <span>班级数量</span>
                        <br>
                        <span>36</span>
                    </div>
                </div>
            </div>
            <div class="tji">
                <div style="color: #333; font-size: 14px;" class="shuji_c">
                    <div style="float: left;">数据统计概览</div>
                    <div style="float: right;">
                        <span >本月</span>
                        <span style="padding-left: 10px;">上月</span>
                        <span style="padding-left: 10px;">本年</span>
                    </div>
                </div>
                <div>
                    <div ref="echartsContainer" style="width: 450px; height: 220px;"></div>
                </div>
            </div>
        </div>
        <div class="bottom">
            <div>
                <div style="color: #333; font-size: 14px;" class="shuji_sd">
                    <div style="float: left;">待办事项</div>
                    <div style="float: right;">更多></div>
                </div>
            </div>
            <div></div>
        </div>
    </div>
   
</template>
<script>

import * as echarts from 'echarts';
export default {
    name:"Shouye",
    data() {
        return{
            currentTime :''
        }
    },
    mounted() {
        this.initChart();
    },
    created(){
        this.currentTime = this.getCurrentTime();
    },
    methods:{
        getCurrentTime() {
            const now = new Date();
            // 格式化时间为YYYY-MM-DD HH:mm:ss
            return (
                now.getFullYear() +
                '-' +
                (now.getMonth() + 1).toString().padStart(2, '0') +
                '-' +
                now.getDate().toString().padStart(2, '0') 
            );
        },
        initChart() {
            const chartContainer = this.$refs.echartsContainer;
            const myChart = echarts.init(chartContainer);
        
            const option = {
                // ECharts 配置项
                title: {
                    text: '安全隐患',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left'
                },
                series: [{
                    name: 'Access From',
                    type: 'pie',
                    radius: '50%',
                    data: [ { value: 1048, name: '已完成' },
                            { value: 735, name: '未完成' },
                        ]
                }]
            };
 
      myChart.setOption(option);
    }
  }
}
</script>
<style scoped>
.top{
    width: 100%;
    height: 74px;
    background-color: #1890ff;
    border: none;
    border-radius: 10px;
}
.top_wx{
    float: left;
    font-family: 'Arial Negreta', 'Arial';
    font-weight: 700;
    font-style: normal;
    font-size: 18px;
    color: #FFFFFF;
    margin-left: 20px;
    margin-top: 20px;
}
.top_sj{
    float: right;
    font-family: 'Arial Normal', 'Arial';
    font-weight: 400;
    font-style: normal;
    color: #FFFFFF;
    font-size: 14px;
    line-height: 70px;
    margin-right: 20px;
}
.shuju{
    margin-top: 10px;
    float: left;
    width: 730px;
    height: 130px;
    background-color: white;
    border: none;
    border-radius: 10px;
}
.shuji_s{
    width: 600px;
    height: 40px;
    margin: 0 auto;
    line-height: 40px;
    border-bottom: solid 1px #a8a7a7;
}
.shuji_sd{
    width: 1200px;
    height: 40px;
    margin: 0 auto;
    line-height: 40px;
    border-bottom: solid 1px #a8a7a7;
}
.shuji_c{
    width: 430px;
    height: 40px;
    margin: 0 auto;
    line-height: 40px;
    border-bottom: solid 1px #a8a7a7;
}
.shuji_j{
    width: 200px;
    text-align: center;
    margin-top: 20px;
    margin-left: 10px;
    float: left;
}
.shuji_xx{
    width: 140px;
    text-align: center;
    margin-top: 30px;
    margin-left: 10px;
    float: left;
}
.tgao{
    margin-top: 10px;
    margin-left: 30px;
    float: left;
    width: 650px;
    height: 130px;
    background-color: white;
    border: none;
    border-radius: 10px;
}
.jichu{
    margin-top: 10px;
    float: left;
    width: 730px;
    height: 220px;
    background-color: white;
    border: none;
    border-radius: 10px;
}
.tji{
    margin-top: 10px;
    margin-left: 30px;
    float: left;
    width: 650px;
    height: 220px;
    background-color: white;
    border: none;
    border-radius: 10px;
}
.bottom{
    float: left;
    width: 100%;
    height: 212px;
    background-color: white;
    margin-top: 10px;
    border: none;
    border-radius: 10px;

}
</style>